/* 479 */
/***/
import * as Cesium from '@cesiumjs';
import {
  G3xObj
} from "@g3xbase"
import * as g3xUtils from "@g3x/utils";
import * as g3vUtils from "@g3v/utils";

/**
 * 地形坡向分析
 * @extends XbsjObject
 */
class AspectRamp extends G3xObj {

  constructor(ramp) {

    super(ramp);
    this.ramp = ramp;
  }
}

g3xUtils.g3x_defineClassProperties(AspectRamp, [{
  key: '_apply',
  value: function _apply() {
    if (!this.enabled) return;
    //获取当前globe设置的材质，如果材质上没有
    var material = this._ramp._globe.material;
    if (!material) return;
    var uniforms = void 0;
    if (material.type == 'AspectRamp') {
      uniforms = material.uniforms;
    } else if (material.materials && material.materials.shading) {
      if (material.materials.shading.type == 'AspectRamp') uniforms = material.materials.shading
        .uniforms;
    }

    if (!uniforms) return;

    //设置image
    uniforms.image = this._ramp._createImage(this.image);
  }
}]);

AspectRamp.defaultOptions = {
  /**
   * 坡向分析启用 和 高程着色分析 、坡度着色分析互斥
   * @type {boolean}
   * @default false
   * @instance
   * @memberof AspectRamp
   */
  enabled: false,
  /**
   * 坡向分析的色带图片
   * @type {string}
   * @default ''
   * @instance
   * @memberof AspectRamp
   */
  image: ''
};

// _XbsjObject3.default.registerType(AspectRamp, 'AspectRamp');

export default AspectRamp;
